package com.foreveross.law.system.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.foreveross.law.system.service.ContractTemplateService;

@Controller
@RequestMapping("/contractTemplate")
public class ContractTemplateController {
	@Autowired
	private ContractTemplateService contractTemplateService;
	
	@RequestMapping(value = "add",method = RequestMethod.POST)
	@ResponseBody
	public void add(@RequestParam String templateName, 
			@RequestParam String templateContent) {
		//poi操作word，生成一个word，保存起来，得到路径还有文件名
		//操作file-io得到文件大小
		//new一个ContractTemplate保存
	}
	
	@RequestMapping(value = "update",method = RequestMethod.POST)
	@ResponseBody
	public void update(@RequestParam String templateName, 
			@RequestParam String templateContent, 
			@RequestParam String contractTemplateId) {
		//通过id得到contractTemplate对象
		//把旧文件删除
		//poi操作word，生成一个word，保存起来，得到路径还有文件名
		//操作file-io得到文件大小
		//new一个ContractTemplate更新
	}
	
	@RequestMapping(value = "get",method = RequestMethod.POST)
	@ResponseBody
	public void get(@RequestParam String contractTemplateId) {
		//通过id得到contractTemplate对象
		//poi读取word内容
		//把内容set到dto中返回ContractTemplateDto
	}
	
	/**
	 * class ContractTemplateDto extends ContractTemplate {
	 * 	private String contractTemplateContent;
	 * }
	 */
}
